<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>-->
    <!--<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>-->
    <!--<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>-->
    <!--[endif]-->
    <script type="text/javascript" src="../../common/js/public.js"></script>
    <script type="text/javascript" src="../../common/js/publicUtils.js"></script>

</head>
<body>
<div class="layui-fluid" id="flowDiv">
    <div class="zTreeBackground right" style="padding-left:1%;width:98%">
        <div class="layui-form-item search_div">
            <div class="layui-inline">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="name" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">组织类型</label>
                <div class="layui-input-inline">
                    <input type="text" id="orgType" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline" style="margin-top: -5px;">
                    <button type="button" style="float: left;margin-left: 12px" class="layui-btn layui-btn-normal" onclick="loadTable()"><i class="layui-icon layui-icon-search"></i>查询</button>
            </div>
        </div>
        <table class="layui-hide" id="datatable" lay-filter="datatable"></table>

    </div>

</div>
</body>
<SCRIPT type="text/javascript">
    var zTreeObj,jobid,form,tableObj,table,level=0,treeNodeId=-1,selecNode,count=1,hideflag=true;
    $(function(){
        loadTable();
    })


    function loadTable(){
        var name = $("#name").val();
        var orgType = $("#orgType").val();
        var tableurl = publicUrl+'orgrole/selectListByOrgRole';
        layui.use(['form','table','element'], function(){
            var element = layui.element;
            form = layui.form;
            table = layui.table;
            tableObj = table.render({
                elem: '#datatable',
                size: 'sm',
                //toolbar: '#toolbar',
                even: true, //开启隔行背景
                height: 'full-100',
                method: 'post',
                headers: {"Authorization":getData("Authorization")},
                url: tableurl, //stationId='+window.parent.window.parentId,//8AE7DECA-8E41-4FAB-8B30-9FD1B0B7FA33,78A9E5D8-20FB-4436-BBE8-A25EAC38D056
                where:{
                    "name":name,
                    "orgType":orgType,
                    'orgTypeName':'OrgType'
                },
                response: {
                    statusCode: 2000,
                },
                parseData: function(res){ //res 即为原始返回的数据
                    return formatTableParseData(res);
                },
                request: {
                    pageName: 'pageIndex' //页码的参数名称，默认：page
                    ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
                },
                cols: [[
                    {
                        type:'checkbox',
                        width: 80,
                    },
                    {
                        type: 'numbers',
                        title: '序号',
                        width: 80,
                        align: 'center',
                    },{
                        field: 'name',
                        title: '名称',
                        sort: true,
                        width: "20%",
                        align: 'center',
                    }, {
                        field: 'sort',
                        title: '排序',
                        sort: true,
                        width: 80,
                        align: 'center'
                    },{
                        field: 'orgTypeName',
                        title: '组织类型',
                        sort: true,
                        width: "15%",
                        align: 'center'
                    },{
                        field: 'description',
                        title: '描述',
                        width: "30%",
                        align: 'center',
                    }]],
                page: true
            });
            element.render();
        });
    }


    /**
     * 保存
     */
    function submit(index, layero){
        var checks= table.checkStatus('datatable');
        var names="";
        var ids="";
        for(var i=0;i<checks.data.length;i++){
            names+=checks.data[i].name;
            ids+=checks.data[i].id;
            if(i!=checks.data.length-1){
                names+=",";
                ids+=",";
            }
        }
        $("#roleName", parent.document).val(names);
        $("#roleId", parent.document).val(ids);
        return true;
    }





</script>
</html>